<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>学生列表</h2>
	</div>
	<div class="cf">
		<div class="fl">
            <a class="btn" href="{:U('add')}">新 增</a>
            <a class="btn" href="{:U('impStudent')}">批量导入</a>
            <!-- <button class="btn ajax-post" url="{:U('changeStatus?method=resumeUser')}" target-form="ids">启 用</button>
            <button class="btn ajax-post" url="{:U('changeStatus?method=forbidUser')}" target-form="ids">禁 用</button>
            <button class="btn ajax-post confirm" url="{:U('changeStatus?method=deleteUser')}" target-form="ids">删 除</button> -->
        </div>

        <!-- 高级搜索 -->
        <form action="{:U('index')}" method="post" class="form-horizontal">
        
		<div class="search-form fr cf"style="width: 500px">
		<select class="form-control" name="classid" style="width: 30%;display: inline-block;float: left;">
					<option value ="" <if condition="I('classid')">selected<else/></if>>选择班级搜索</option>
					<option value ="-1" <if condition="I('classid')==-1">selected<else/></if>>无班级</option>
					<notempty name="Class_list">
					<volist name="Class_list" id="vo">
					<option value = {$vo.id} <if condition="I('classid')==$vo['id']">selected<else/></if>>{$vo.class_name}</option>
					</volist>
					</notempty>
				</select>
			<div class="sleft" style="margin:2px">
				<input type="text" name="username" class="search-input" value="{:I('username')}" placeholder="请输入学生姓名或者学号">
				<!-- <a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a> -->
				<button class="sch-btn" id="submit" type="submit" target-form="{:U('index')}" style="border:0;background:#fff;"><i class="btn-search"></i></button>
			</div>
		</div>
		</form>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
		<!-- <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th> -->
		<th class="">序号</th>
		<th class="">学号</th>
		<th class="">用户名</th>
		<th class="">姓名</th>
		<th class="">所属班级</th>
		
		<th class="">在校状态</th>
		<th class="">用户状态</th>
		<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
            <!-- <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td> -->
			
			<td>{$key+1}</td>
			<td>{$vo.sno|substr=4}</td>
			<td>{$vo.uc_username}</td>
			<td>{$vo.username}</td>
			<td>{$vo.class_name}</td>
			<td><eq name="vo.isstudy" value="1">
				在校</eq>
				</td>
			<td><eq name="vo.status" value="1">
				正常<else/>已禁用</eq>
				</td>
			<td><a href="{:U('Student/detail?id='.$vo['id'])}" class="authorize">编辑</a>
				<eq name="vo.status" value="1">
				<a href="{:U('Student/changeStatus?method=forbidStudent&id='.$vo['id'])}" class="ajax-get">禁用</a>
				<else/>
				<a href="{:U('Student/changeStatus?method=resumeStudent&id='.$vo['id'])}" class="ajax-get">启用</a>
				</eq>
				<a href="{:U('Student/changeStatus?method=drop&id='.$vo['id'])}" class="confirm ajax-get">退学</a>
				<!-- <a href="{:U('Student/changeStatus?method=graduate&id='.$vo['id'])}" class="confirm ajax-get">毕业</a>
				<!-- <a href="{:U('Student/detail?id='.$vo['id'])}" class="authorize">详细信息</a> -->
				<a href="{:U('Student/resetPassword?id='.$vo['id'])}" class="ajax-get">重置密码</a>
                <a href="{:U('Student/changeStatus?method=deleteStudent&id='.$vo['id'])}" class="confirm ajax-get">删除</a>
                </td>
		</tr>
		</volist>
		<else/>
		<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

	<script type="text/javascript">
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
    //导航高亮
    highlight_subnav('{:U('Student/index')}');
	</script>
</block>